#include "common.h"

void initTensorData(Tensor& tensor) {
    srand(time(0));
    if (tensor.data_type == DataType::FLOAT32) {
        float* data_ptr = (float*)tensor.data;
        for (size_t i = 0; i < tensor.num_dims; ++i) {
            data_ptr[i] = (float)i;
            //data_ptr[i] = static_cast<float>((float)rand() / RAND_MAX);  // 填充0到99之间的随机数
        }
    } else if (tensor.data_type == DataType::INT32) {
        int* data_ptr = (int*)tensor.data;
        for (size_t i = 0; i < tensor.num_dims; ++i) {
            data_ptr[i] = static_cast<int>(rand() % 100);
        }
    }
}

